<?php
#error_reporting(0);
header("Content-type:text/html;charset=utf-8");
$con = mysql_connect("localhost", "root", "");
mysql_select_db("se", $con);
$name = $_POST['newaccountname'];
$password = $_POST['newpassword'];
$gender =$_POST['gender'];
echo $name;
echo "<br>";
echo $password;
if ($name==""){
	echo "<script type='text/javascript'>alert('账号不能为空，请输入账号');location='create.html';</script>";
}
else if($password==""){
	echo "<script type='text/javascript'>alert('密码不能为空，请输入账号');location='create.html';</script>";
}
else if($gender==""){
	echo "<script type='text/javascript'>alert('请输入性别');location='create.html';</script>";
}
else{
	$sql = "SELECT * FROM cus WHERE account = '$name'";
	$res = mysql_query($sql);
	$colum = mysql_fetch_array($res);
	if($colum['account']==$name){
		echo "<script type='text/javascript'>alert('账号已存在！');location='create.html';</script>";
	}
	else{
		$sql="INSERT INTO cus(account,password,gender) VALUES('$name','$password','$gender')";
		$res = mysql_query($sql);
		echo "<script type='text/javascript'>alert('注册成功!');location='Homepage123.html';</script>";
	}

}

?>